Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

whatwg-encoding

Package Overview
Dependencies
Maintainers
6
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whatwg-encoding

Decode strings according to the WHATWG Encoding Standard

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23M
decreased by-9.23%
Maintainers
6
Weekly downloads
 
Created

What is whatwg-encoding?

The whatwg-encoding npm package is a JavaScript implementation of the WHATWG Encoding Standard. It allows for encoding and decoding of text using various character encodings as specified by the standard.

What are whatwg-encoding's main functionalities?

Text Decoding

This feature allows you to decode a Uint8Array of text data into a string using a specified encoding. In the code sample, a Uint8Array representing the UTF-8 encoded string 'Hello' is decoded back into a JavaScript string.

"use strict";
const { decode } = require('whatwg-encoding');
const uint8Array = new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f]);
const text = decode(uint8Array, 'utf-8');
console.log(text); // 'Hello'

Text Encoding

This feature allows you to encode a JavaScript string into a Uint8Array using a specified encoding. In the code sample, the string 'Hello' is encoded into a Uint8Array using UTF-8 encoding.

"use strict";
const { encode } = require('whatwg-encoding');
const text = 'Hello';
const uint8Array = encode(text, 'utf-8');
console.log(uint8Array); // Uint8Array showing the bytes of the encoded string

Other packages similar to whatwg-encoding

Keywords

FAQs

Package last updated on 12 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc